@page "/organization/verify"
@using Microsoft.Extensions.Options
@using Passwordless.Common.Services.Mail

@attribute [AllowAnonymous]

@inject IOptionsSnapshot<MailConfiguration> MailOptions
@inject IHttpContextAccessor HttpContextAccessor
@inject NavigationManager NavigationManager
@inject IWebHostEnvironment WebHostEnvironment

<HeadContent>
    @* This to refresh the page to check if the user has verified and logged in *@
    <meta http-equiv="refresh" content="15" />
</HeadContent>

<Page>
    <div class="flex flex-col items-center py-10 sm:max-w-xl mx-auto">
    <span class="p-4 text-white rounded-full bg-primary-700">
        <MailIcon Class="text-white w-8 h-8" />
    </span>
        <h2 class="mt-6 mb-8 text-center">Check your email to verify your account</h2>
        <p class="mt-4 text-center">We've sent a confirmation link to the email address you provided. Click on the link in the email to verify your account.</p>
    </div>

    @if (ShouldShowFileMailPath && FileMailPath != null)
    {
        <div id="file-provider-debug-section">
            <p>
                <b>Development mode:</b> Email history is saved to <code>@FileMailPath</code> and displayed below.
            </p>

            @if (FileMailPathExists && FileMailContent != null)
            {
                <pre class="mt-4 text-wrap break-all">
                    <code>@FileMailContent</code>
                </pre>
            }
            else
            {
                <p class="mt-4">No emails have been sent yet.</p>
            }
        </div>
    }
</Page>